cyrus-sasl: fix build with GCC 15.1
authorW. Michael Petullo <[email protected]>
Mon, 28 Jul 2025 01:01:04 +0000 (20:01 -0500)
committerJosef Schlehofer <[email protected]>
Tue, 29 Jul 2025 07:04:52 +0000 (09:04 +0200)
Apply the patch Fedora uses, named cyrus-sasl-2.1.28-gcc15.patch there,
to fix building with GCC 15.1. As with other recent versions, GCC 15.1
transforms some warnings into errors, and this patch removes those
warnings, now errors. Upstream accepted a similar patch by the same
author at:

https://github.com/cyrusimap/cyrus-sasl/pull/869

The commit described here does not use the upstream patch because it
assumes the removal of CRAM-MD5 (lib/md5.c), but this has not happened
as of the packaged version, namely 2.1.28. A future release will clean
all of this up and remove the need for the patch this commit adds.

Signed-off-by: W. Michael Petullo <[email protected]>
libs/cyrus-sasl/Makefile
libs/cyrus-sasl/patches/020-gcc15.patch [new file with mode: 0644]

index ae036b5b2f652c66a36aa5c730f20ffc41de8061..aeb2be3ab6736df6fe753095f7b13b65ad191b12 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=cyrus-sasl
 PKG_VERSION:=2.1.28
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_MAINTAINER:=W. Michael Petullo <[email protected]>
 
diff --git a/libs/cyrus-sasl/patches/020-gcc15.patch b/libs/cyrus-sasl/patches/020-gcc15.patch
new file mode 100644 (file)
index 0000000..121d4da
--- /dev/null
@@ -0,0 +1,796 @@
+From 8bb2a1b719c6538589897e3d409a0d2362a8a8b9 Mon Sep 17 00:00:00 2001
+From: Rob Crittenden <[email protected]>
+Date: Tue, 21 Jan 2025 13:51:24 -0500
+Subject: [PATCH] Add compatibility for gcc 15
+
+Fedora 42 is going to use gcc 15 which changes some warnings into errors. Address the issues raised.
+
+The issues addressed include:
+
+* The RETURN macro is defined differently in two places. Rename one.
+* Both atexit and the sigint and sigterm actions call server_exit().
+  The function arguments differ. Introduce a new generic signal handler
+  to call server_exit() for sigint and sigterm signals.
+
+Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2340025
+
+Signed-off-by: Rob Crittenden <[email protected]>
+---
+ lib/auxprop.c              |  2 +-
+ lib/canonusr.c             |  6 ++--
+ lib/client.c               |  6 ++--
+ lib/common.c               | 40 ++++++++++++-------------
+ lib/md5.c                  | 48 +++++++++---------------------
+ lib/saslint.h              |  8 ++---
+ lib/server.c               | 32 ++++++++++----------
+ saslauthd/auth_sasldb.c    |  4 +--
+ saslauthd/md5.c            | 60 ++++++++++++--------------------------
+ saslauthd/saslauthd-main.c | 12 +++++---
+ saslauthd/saslauthd-main.h |  5 ++--
+ saslauthd/saslauthd_md5.h  |  9 +++---
+ 12 files changed, 95 insertions(+), 137 deletions(-)
+
+--- a/lib/auxprop.c
++++ b/lib/auxprop.c
+@@ -780,7 +780,7 @@ int sasl_auxprop_request(sasl_conn_t *co
+     }
+     
+     result = prop_request(sconn->sparams->propctx, propnames);
+-    RETURN(conn, result);
++    RETURN_VAL(conn, result);
+ }
+--- a/lib/canonusr.c
++++ b/lib/canonusr.c
+@@ -192,7 +192,7 @@ int _sasl_canon_user(sasl_conn_t *conn,
+       oparams->user = conn->user_buf;
+     }
+-    RETURN(conn, result);
++    RETURN_VAL(conn, result);
+ }
+ /* Lookup all properties for authentication and/or authorization identity. */
+@@ -256,7 +256,7 @@ static int _sasl_auxprop_lookup_user_pro
+     }
+ #endif
+-    RETURN(conn, result);
++    RETURN_VAL(conn, result);
+ }
+ /* default behavior:
+@@ -285,7 +285,7 @@ int _sasl_canon_user_lookup (sasl_conn_t
+                                                 oparams);
+     }
+-    RETURN(conn, result);
++    RETURN_VAL(conn, result);
+ }
+ void _sasl_canonuser_free() 
+--- a/lib/client.c
++++ b/lib/client.c
+@@ -435,7 +435,7 @@ int sasl_client_new(const char *service,
+                          &client_idle, serverFQDN,
+                          iplocalport, ipremoteport,
+                          prompt_supp, &global_callbacks_client);
+-  if (result != SASL_OK) RETURN(*pconn, result);
++  if (result != SASL_OK) RETURN_VAL(*pconn, result);
+   
+   utils = _sasl_alloc_utils(*pconn, &global_callbacks_client);
+   if (utils == NULL) {
+@@ -879,7 +879,7 @@ int sasl_client_start(sasl_conn_t *conn,
+  done:
+     if (ordered_mechs != NULL)
+       c_conn->cparams->utils->free(ordered_mechs);
+-    RETURN(conn, result);
++    RETURN_VAL(conn, result);
+ }
+ /* do a single authentication step.
+@@ -952,7 +952,7 @@ int sasl_client_step(sasl_conn_t *conn,
+       }
+   }  
+-  RETURN(conn,result);
++  RETURN_VAL(conn,result);
+ }
+ /* returns the length of all the mechanisms
+--- a/lib/common.c
++++ b/lib/common.c
+@@ -303,7 +303,7 @@ int sasl_encode(sasl_conn_t *conn, const
+     
+     result = sasl_encodev(conn, &tmp, 1, output, outputlen);
+-    RETURN(conn, result);
++    RETURN_VAL(conn, result);
+ }
+ /* Internal function that doesn't do any verification */
+@@ -389,7 +389,7 @@ _sasl_encodev (sasl_conn_t *conn,
+     (*p_num_packets)++;
+-    RETURN(conn, result);
++    RETURN_VAL(conn, result);
+ }
+ /* security-encode an iovec */
+@@ -434,7 +434,7 @@ int sasl_encodev(sasl_conn_t *conn,
+       *output = conn->encode_buf->data;
+       *outputlen = (unsigned) conn->encode_buf->curlen;
+-        RETURN(conn, result);
++        RETURN_VAL(conn, result);
+     }
+     /* This might be better to check on a per-plugin basis, but I think
+@@ -592,7 +592,7 @@ cleanup:
+         sasl_FREE(cur_invec);
+     }
+-    RETURN(conn, result);
++    RETURN_VAL(conn, result);
+ }
+  
+ /* output is only valid until next call to sasl_decode */
+@@ -609,7 +609,7 @@ int sasl_decode(sasl_conn_t *conn,
+     if(!conn->props.maxbufsize) {
+       sasl_seterror(conn, 0,
+                     "called sasl_decode with application that does not support security layers");
+-      RETURN(conn, SASL_TOOWEAK);
++      RETURN_VAL(conn, SASL_TOOWEAK);
+     }
+     if(conn->oparams.decode == NULL)
+@@ -623,7 +623,7 @@ int sasl_decode(sasl_conn_t *conn,
+       if(inputlen > conn->props.maxbufsize) {
+           sasl_seterror(conn, 0,
+                         "input too large for default sasl_decode");
+-          RETURN(conn,SASL_BUFOVER);
++          RETURN_VAL(conn,SASL_BUFOVER);
+       }
+       if(!conn->decode_buf)
+@@ -644,7 +644,7 @@ int sasl_decode(sasl_conn_t *conn,
+       /* NULL an empty buffer (for misbehaved applications) */
+       if (*outputlen == 0) *output = NULL;
+-        RETURN(conn, result);
++        RETURN_VAL(conn, result);
+     }
+     INTERROR(conn, SASL_FAIL);
+@@ -738,11 +738,11 @@ int _sasl_conn_init(sasl_conn_t *conn,
+   result = sasl_setprop(conn, SASL_IPLOCALPORT, iplocalport);
+   if(result != SASL_OK)
+-      RETURN(conn, result);
++      RETURN_VAL(conn, result);
+   
+   result = sasl_setprop(conn, SASL_IPREMOTEPORT, ipremoteport);
+   if(result != SASL_OK)
+-      RETURN(conn, result);
++      RETURN_VAL(conn, result);
+   
+   conn->encode_buf = NULL;
+   conn->context = NULL;
+@@ -787,7 +787,7 @@ int _sasl_conn_init(sasl_conn_t *conn,
+   if(result != SASL_OK) MEMERROR( conn );
+-  RETURN(conn, SASL_OK);
++  RETURN_VAL(conn, SASL_OK);
+ }
+ int _sasl_common_init(sasl_global_callbacks_t *global_callbacks)
+@@ -1068,11 +1068,11 @@ int sasl_getprop(sasl_conn_t *conn, int
+   } else if(result == SASL_NOTDONE) {
+       sasl_seterror(conn, SASL_NOLOG,
+                   "Information that was requested is not yet available.");
+-      RETURN(conn, result);
++      RETURN_VAL(conn, result);
+   } else if(result != SASL_OK) {
+       INTERROR(conn, result);
+   } else
+-      RETURN(conn, result); 
++      RETURN_VAL(conn, result);
+ }
+ /* set property in SASL connection state
+@@ -1146,7 +1146,7 @@ int sasl_setprop(sasl_conn_t *conn, int
+       if(props->maxbufsize == 0 && props->min_ssf != 0) {
+         sasl_seterror(conn, 0,
+                       "Attempt to disable security layers (maxoutbuf == 0) with min_ssf > 0");
+-        RETURN(conn, SASL_TOOWEAK);
++        RETURN_VAL(conn, SASL_TOOWEAK);
+       }
+       conn->props = *props;
+@@ -1168,7 +1168,7 @@ int sasl_setprop(sasl_conn_t *conn, int
+       } else if (_sasl_ipfromstring(ipremoteport, NULL, 0)
+                != SASL_OK) {
+         sasl_seterror(conn, 0, "Bad IPREMOTEPORT value");
+-        RETURN(conn, SASL_BADPARAM);
++        RETURN_VAL(conn, SASL_BADPARAM);
+       } else {
+         strcpy(conn->ipremoteport, ipremoteport);
+         conn->got_ip_remote = 1;
+@@ -1209,7 +1209,7 @@ int sasl_setprop(sasl_conn_t *conn, int
+       } else if (_sasl_ipfromstring(iplocalport, NULL, 0)
+                != SASL_OK) {
+         sasl_seterror(conn, 0, "Bad IPLOCALPORT value");
+-        RETURN(conn, SASL_BADPARAM);
++        RETURN_VAL(conn, SASL_BADPARAM);
+       } else {
+         strcpy(conn->iplocalport, iplocalport);
+         conn->got_ip_local = 1;
+@@ -1302,7 +1302,7 @@ int sasl_setprop(sasl_conn_t *conn, int
+       result = SASL_BADPARAM;
+   }
+   
+-  RETURN(conn, result);
++  RETURN_VAL(conn, result);
+ }
+ /* this is apparently no longer a user function */
+@@ -1708,7 +1708,7 @@ _sasl_proxy_policy(sasl_conn_t *conn,
+       (memcmp(auth_identity, requested_user, rlen) != 0)) {
+       sasl_seterror(conn, 0,
+                     "Requested identity not authenticated identity");
+-      RETURN(conn, SASL_BADAUTH);
++      RETURN_VAL(conn, SASL_BADAUTH);
+     }
+     return SASL_OK;
+@@ -1809,7 +1809,7 @@ int _sasl_getcallback(sasl_conn_t * conn
+   *pproc = NULL;
+   *pcontext = NULL;
+   sasl_seterror(conn, SASL_NOLOG, "Unable to find a callback: %d", callbackid);
+-  RETURN(conn,SASL_FAIL);
++  RETURN_VAL(conn,SASL_FAIL);
+ }
+@@ -2405,10 +2405,10 @@ int sasl_listmech(sasl_conn_t *conn,
+     if(!conn) {
+       return SASL_BADPARAM;
+     } else if(conn->type == SASL_CONN_SERVER) {
+-      RETURN(conn, _sasl_server_listmech(conn, user, prefix, sep, suffix,
++      RETURN_VAL(conn, _sasl_server_listmech(conn, user, prefix, sep, suffix,
+                                          result, plen, pcount));
+     } else if (conn->type == SASL_CONN_CLIENT) {
+-      RETURN(conn, _sasl_client_listmech(conn, prefix, sep, suffix,
++      RETURN_VAL(conn, _sasl_client_listmech(conn, prefix, sep, suffix,
+                                          result, plen, pcount));
+     }
+     
+--- a/lib/md5.c
++++ b/lib/md5.c
+@@ -54,13 +54,11 @@ documentation and/or software.
+ #define S43 15
+ #define S44 21
+-static void MD5Transform PROTO_LIST ((UINT4 [4], const unsigned char [64]));
+-static void Encode PROTO_LIST
+-       ((unsigned char *, UINT4 *, unsigned int)); 
+-static void Decode PROTO_LIST
+-       ((UINT4 *, const unsigned char *, unsigned int)); 
+-static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int));
+-static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int));
++static void MD5Transform (UINT4 [4], const unsigned char [64]);
++static void Encode (unsigned char *, UINT4 *, unsigned int);
++static void Decode (UINT4 *, const unsigned char *, unsigned int);
++static void MD5_memcpy (POINTER, POINTER, unsigned int);
++static void MD5_memset (POINTER, int, unsigned int);
+ static unsigned char PADDING[64] = {
+        0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+@@ -98,8 +96,7 @@ Rotation is separate from addition to pr
+ /* MD5 initialization. Begins an MD5 operation, writing a new context.
+ */
+-void _sasl_MD5Init (context)
+-MD5_CTX *context; /* context */
++void _sasl_MD5Init (MD5_CTX *context)
+ {
+        context->count[0] = context->count[1] = 0; 
+@@ -114,10 +111,7 @@ MD5_CTX *context; /* context */
+        operation, processing another message block, and updating the context. 
+ */
+-void _sasl_MD5Update (context, input, inputLen)
+-MD5_CTX *context; /* context */
+-const unsigned char *input; /* input block */
+-unsigned int inputLen; /* length of input block */
++void _sasl_MD5Update (MD5_CTX *context, const unsigned char *input, unsigned int inputLen)
+ {
+        unsigned int i, index, partLen; 
+@@ -159,9 +153,7 @@ unsigned int inputLen; /* length of inpu
+        the message digest and zeroizing the context. 
+ */
+-void _sasl_MD5Final (digest, context)
+-unsigned char digest[16]; /* message digest */
+-MD5_CTX *context; /* context */
++void _sasl_MD5Final (unsigned char digest[16], MD5_CTX *context)
+ {
+        unsigned char bits[8]; 
+        unsigned int index, padLen; 
+@@ -186,9 +178,7 @@ MD5_CTX *context; /* context */
+ /* MD5 basic transformation. Transforms state based on block. */
+-static void MD5Transform (state, block)
+-UINT4 state[4];
+-const unsigned char block[64];
++static void MD5Transform (UINT4 state[4], const unsigned char block[64])
+ {
+        UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; 
+@@ -281,10 +271,7 @@ const unsigned char block[64];
+         */
+-static void Encode (output, input, len)
+-unsigned char *output;
+-UINT4 *input;
+-unsigned int len;
++static void Encode (unsigned char *output, UINT4 *input, unsigned int len)
+ {
+        unsigned int i, j; 
+@@ -301,10 +288,7 @@ unsigned int len;
+         */
+-static void Decode (output, input, len)
+-UINT4 *output;
+-const unsigned char *input;
+-unsigned int len;
++static void Decode (UINT4 *output, const unsigned char *input, unsigned int len)
+ {
+        unsigned int i, j; 
+@@ -317,10 +301,7 @@ unsigned int len;
+         */
+-static void MD5_memcpy (output, input, len)
+-POINTER output;
+-POINTER input;
+-unsigned int len;
++static void MD5_memcpy (POINTER output, POINTER input, unsigned int len)
+ {
+        unsigned int i; 
+@@ -331,10 +312,7 @@ unsigned int len;
+ /* Note: Replace "for loop" with standard memset if possible.
+ */
+-static void MD5_memset (output, value, len)
+-POINTER output;
+-int value;
+-unsigned int len;
++static void MD5_memset (POINTER output, int value, unsigned int len)
+ {
+        unsigned int i; 
+--- a/lib/saslint.h
++++ b/lib/saslint.h
+@@ -74,22 +74,22 @@
+  *   memory errors.
+  *  -Only errors (error codes < SASL_OK) should be remembered
+  */
+-#define RETURN(conn, val) { if(conn && (val) < SASL_OK) \
++#define RETURN_VAL(conn, val) { if(conn && (val) < SASL_OK) \
+                                (conn)->error_code = (val); \
+                             return (val); }
+ #define MEMERROR(conn) {\
+     if(conn) sasl_seterror( (conn), 0, \
+                    "Out of Memory in " __FILE__ " near line %d", __LINE__ ); \
+-    RETURN(conn, SASL_NOMEM) }
++    RETURN_VAL(conn, SASL_NOMEM) }
+ #define PARAMERROR(conn) {\
+     if(conn) sasl_seterror( (conn), SASL_NOLOG, \
+                   "Parameter error in " __FILE__ " near line %d", __LINE__ ); \
+-    RETURN(conn, SASL_BADPARAM) }
++    RETURN_VAL(conn, SASL_BADPARAM) }
+ #define INTERROR(conn, val) {\
+     if(conn) sasl_seterror( (conn), 0, \
+                    "Internal Error %d in " __FILE__ " near line %d", (val),\
+                  __LINE__ ); \
+-    RETURN(conn, (val)) }
++    RETURN_VAL(conn, (val)) }
+ #ifndef PATH_MAX
+ # ifdef WIN32
+--- a/lib/server.c
++++ b/lib/server.c
+@@ -155,7 +155,7 @@ int sasl_setpass(sasl_conn_t *conn,
+        (current_mech == NULL) ) {
+       sasl_seterror( conn, SASL_NOLOG,
+                   "No current SASL mechanism available");
+-      RETURN(conn, SASL_BADPARAM);
++      RETURN_VAL(conn, SASL_BADPARAM);
+     }
+     /* Do we want to store SASL_AUX_PASSWORD_PROP (plain text)?  and
+@@ -297,7 +297,7 @@ int sasl_setpass(sasl_conn_t *conn,
+       }
+     }
+-    RETURN(conn, result);
++    RETURN_VAL(conn, result);
+ }
+ /* local mechanism which disposes of server */
+@@ -991,7 +991,7 @@ _sasl_transition(sasl_conn_t * conn,
+                             NULL, 0, SASL_SET_CREATE | flags);
+     }
+-    RETURN(conn,result);
++    RETURN_VAL(conn,result);
+ }
+@@ -1367,7 +1367,7 @@ static int do_authorization(sasl_server_
+                  (s_conn->user_realm ? (unsigned) strlen(s_conn->user_realm) : 0),
+                  s_conn->sparams->propctx);
+-    RETURN(&s_conn->base, ret);
++    RETURN_VAL(&s_conn->base, ret);
+ }
+@@ -1484,7 +1484,7 @@ int sasl_server_start(sasl_conn_t *conn,
+       if (result != SASL_OK) {
+           /* The library will eventually be freed, don't sweat it */
+-          RETURN(conn, result);
++          RETURN_VAL(conn, result);
+       }
+     }
+@@ -1573,7 +1573,7 @@ int sasl_server_start(sasl_conn_t *conn,
+       conn->oparams.doneflag = 0;
+     }
+     
+-    RETURN(conn,result);
++    RETURN_VAL(conn,result);
+ }
+@@ -1701,7 +1701,7 @@ int sasl_server_step(sasl_conn_t *conn,
+       conn->oparams.doneflag = 0;
+     }
+-    RETURN(conn, ret);
++    RETURN_VAL(conn, ret);
+ }
+ /* returns the length of all the mechanisms
+@@ -1950,7 +1950,7 @@ static int _sasl_checkpass(sasl_conn_t *
+     if (result != SASL_OK)
+       sasl_seterror(conn, SASL_NOLOG, "checkpass failed");
+-    RETURN(conn, result);
++    RETURN_VAL(conn, result);
+ }
+ /* check if a plaintext password is valid
+@@ -1990,7 +1990,7 @@ int sasl_checkpass(sasl_conn_t *conn,
+     result = _sasl_canon_user(conn, user, userlen,
+                             SASL_CU_AUTHID | SASL_CU_AUTHZID,
+                             &(conn->oparams));
+-    if(result != SASL_OK) RETURN(conn, result);
++    if(result != SASL_OK) RETURN_VAL(conn, result);
+     user = conn->oparams.user;
+     /* Check the password and lookup additional properties */
+@@ -2001,7 +2001,7 @@ int sasl_checkpass(sasl_conn_t *conn,
+       result = do_authorization((sasl_server_conn_t *)conn);
+     }
+-    RETURN(conn,result);
++    RETURN_VAL(conn,result);
+ }
+ /* check if a user exists on server
+@@ -2074,7 +2074,7 @@ int sasl_user_exists(sasl_conn_t *conn,
+       sasl_seterror(conn, SASL_NOLOG, "no plaintext password verifier?");
+     }
+-    RETURN(conn, result);
++    RETURN_VAL(conn, result);
+ }
+ /* check if an apop exchange is valid
+@@ -2136,7 +2136,7 @@ int sasl_checkapop(sasl_conn_t *conn,
+     if (!user_end || strspn(user_end + 1, "0123456789abcdef") != 32) 
+     {
+         sasl_seterror(conn, 0, "Bad Digest");
+-        RETURN(conn,SASL_BADPROT);
++        RETURN_VAL(conn,SASL_BADPROT);
+     }
+  
+     user_len = (size_t)(user_end - response);
+@@ -2148,7 +2148,7 @@ int sasl_checkapop(sasl_conn_t *conn,
+     if(result != SASL_OK) 
+     {
+         sasl_FREE(user);
+-        RETURN(conn, result);
++        RETURN_VAL(conn, result);
+     }
+     /* erase the plaintext password */
+@@ -2163,7 +2163,7 @@ int sasl_checkapop(sasl_conn_t *conn,
+                                     &(conn->oparams));
+     sasl_FREE(user);
+-    if(result != SASL_OK) RETURN(conn, result);
++    if(result != SASL_OK) RETURN_VAL(conn, result);
+     /* Do APOP verification */
+     result = _sasl_auxprop_verify_apop(conn, conn->oparams.authid,
+@@ -2178,11 +2178,11 @@ int sasl_checkapop(sasl_conn_t *conn,
+       conn->oparams.authid = NULL;
+     }
+-    RETURN(conn, result);
++    RETURN_VAL(conn, result);
+ #else /* sasl_checkapop was disabled at compile time */
+     sasl_seterror(conn, SASL_NOLOG,
+       "sasl_checkapop called, but was disabled at compile time");
+-    RETURN(conn, SASL_NOMECH);
++    RETURN_VAL(conn, SASL_NOMECH);
+ #endif /* DO_SASL_CHECKAPOP */
+ }
+--- a/saslauthd/auth_sasldb.c
++++ b/saslauthd/auth_sasldb.c
+@@ -51,9 +51,7 @@
+ #include "../sasldb/sasldb.h"
+ static int
+-vf(void *context __attribute__((unused)),
+-   char *file  __attribute__((unused)),
+-   int type  __attribute__((unused)))
++vf(void)
+ {
+     /* always say ok */ 
+     return SASL_OK;
+--- a/saslauthd/md5.c
++++ b/saslauthd/md5.c
+@@ -54,13 +54,11 @@ documentation and/or software.
+ #define S43 15
+ #define S44 21
+-static void MD5Transform PROTO_LIST ((UINT4 [4], unsigned char [64]));
+-static void Encode PROTO_LIST
+-       ((unsigned char *, UINT4 *, unsigned int)); 
+-static void Decode PROTO_LIST
+-       ((UINT4 *, unsigned char *, unsigned int)); 
+-static void MD5_memcpy PROTO_LIST ((POINTER, POINTER, unsigned int));
+-static void MD5_memset PROTO_LIST ((POINTER, int, unsigned int));
++static void MD5Transform (UINT4 [4], unsigned char [64]);
++static void Encode (unsigned char *, UINT4 *, unsigned int);
++static void Decode (UINT4 *, unsigned char *, unsigned int);
++static void MD5_memcpy (POINTER, POINTER, unsigned int);
++static void MD5_memset (POINTER, int, unsigned int);
+ static unsigned char PADDING[64] = {
+        0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+@@ -98,8 +96,7 @@ Rotation is separate from addition to pr
+ /* MD5 initialization. Begins an MD5 operation, writing a new context.
+ */
+-void _saslauthd_MD5Init (context)
+-MD5_CTX *context; /* context */
++void _saslauthd_MD5Init (MD5_CTX *context)
+ {
+        context->count[0] = context->count[1] = 0; 
+@@ -114,10 +111,7 @@ MD5_CTX *context; /* context */
+        operation, processing another message block, and updating the context. 
+ */
+-void _saslauthd_MD5Update (context, input, inputLen)
+-MD5_CTX *context; /* context */
+-unsigned char *input; /* input block */
+-unsigned int inputLen; /* length of input block */
++void _saslauthd_MD5Update (MD5_CTX *context, unsigned char *input, unsigned int inputLen)
+ {
+        unsigned int i, index, partLen; 
+@@ -159,9 +153,7 @@ unsigned int inputLen; /* length of inpu
+        the message digest and zeroizing the context. 
+ */
+-void _saslauthd_MD5Final (digest, context)
+-unsigned char digest[16]; /* message digest */
+-MD5_CTX *context; /* context */
++void _saslauthd_MD5Final (unsigned char digest[16], MD5_CTX *context)
+ {
+        unsigned char bits[8]; 
+        unsigned int index, padLen; 
+@@ -186,9 +178,7 @@ MD5_CTX *context; /* context */
+ /* MD5 basic transformation. Transforms state based on block. */
+-static void MD5Transform (state, block)
+-UINT4 state[4];
+-unsigned char block[64];
++static void MD5Transform (UINT4 state[4], unsigned char block[64])
+ {
+        UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; 
+@@ -281,10 +271,7 @@ unsigned char block[64];
+         */
+-static void Encode (output, input, len)
+-unsigned char *output;
+-UINT4 *input;
+-unsigned int len;
++static void Encode (unsigned char *output, UINT4 *input, unsigned int len)
+ {
+        unsigned int i, j; 
+@@ -301,10 +288,7 @@ unsigned int len;
+         */
+-static void Decode (output, input, len)
+-UINT4 *output;
+-unsigned char *input;
+-unsigned int len;
++static void Decode (UINT4 *output, unsigned char *input, unsigned int len)
+ {
+        unsigned int i, j; 
+@@ -317,10 +301,7 @@ unsigned int len;
+         */
+-static void MD5_memcpy (output, input, len)
+-POINTER output;
+-POINTER input;
+-unsigned int len;
++static void MD5_memcpy (POINTER output, POINTER input, unsigned int len)
+ {
+        unsigned int i; 
+@@ -331,10 +312,7 @@ unsigned int len;
+ /* Note: Replace "for loop" with standard memset if possible.
+ */
+-static void MD5_memset (output, value, len)
+-POINTER output;
+-int value;
+-unsigned int len;
++static void MD5_memset (POINTER output, int value, unsigned int len)
+ {
+        unsigned int i; 
+@@ -360,7 +338,7 @@ void _saslauthd_hmac_md5_init(HMAC_MD5_C
+     MD5_CTX      tctx;
+     _saslauthd_MD5Init(&tctx); 
+-    _saslauthd_MD5Update(&tctx, key, key_len); 
++    _saslauthd_MD5Update(&tctx, (unsigned char *)key, key_len);
+     _saslauthd_MD5Final(tk, &tctx); 
+     key = tk; 
+@@ -397,9 +375,9 @@ void _saslauthd_hmac_md5_init(HMAC_MD5_C
+   _saslauthd_MD5Update(&hmac->octx, k_opad, 64);     /* apply outer pad */
+   /* scrub the pads and key context (if used) */
+-  MD5_memset(&k_ipad, 0, sizeof(k_ipad));
+-  MD5_memset(&k_opad, 0, sizeof(k_opad));
+-  MD5_memset(&tk, 0, sizeof(tk));
++  MD5_memset((POINTER)&k_ipad, 0, sizeof(k_ipad));
++  MD5_memset((POINTER)&k_opad, 0, sizeof(k_opad));
++  MD5_memset((POINTER)&tk, 0, sizeof(tk));
+   /* and we're done. */
+ }
+@@ -424,7 +402,7 @@ void _saslauthd_hmac_md5_precalc(HMAC_MD
+     state->istate[lupe] = htonl(hmac.ictx.state[lupe]);
+     state->ostate[lupe] = htonl(hmac.octx.state[lupe]);
+   }
+-  MD5_memset(&hmac, 0, sizeof(hmac));
++  MD5_memset((POINTER)&hmac, 0, sizeof(hmac));
+ }
+@@ -432,7 +410,7 @@ void _saslauthd_hmac_md5_import(HMAC_MD5
+                               HMAC_MD5_STATE *state)
+ {
+   unsigned lupe;
+-  MD5_memset(hmac, 0, sizeof(HMAC_MD5_CTX));
++  MD5_memset((POINTER)hmac, 0, sizeof(HMAC_MD5_CTX));
+   for (lupe = 0; lupe < 4; lupe++) {
+     hmac->ictx.state[lupe] = ntohl(state->istate[lupe]);
+     hmac->octx.state[lupe] = ntohl(state->ostate[lupe]);
+--- a/saslauthd/saslauthd-main.c
++++ b/saslauthd/saslauthd-main.c
+@@ -593,7 +593,7 @@ void signal_setup() {
+       /**************************************************************
+        * Handler for SIGTERM
+        **************************************************************/
+-      act_sigterm.sa_handler = server_exit;
++      act_sigterm.sa_handler = handle_exit;
+       sigemptyset(&act_sigterm.sa_mask);
+       if (sigaction(SIGTERM, &act_sigterm, NULL) != 0) {
+@@ -606,7 +606,7 @@ void signal_setup() {
+       /**************************************************************
+        * Handler for SIGINT
+        **************************************************************/
+-      act_sigint.sa_handler = server_exit;
++      act_sigint.sa_handler = handle_exit;
+       sigemptyset(&act_sigint.sa_mask);
+       if (sigaction(SIGINT, &act_sigint, NULL) != 0) {
+@@ -876,7 +876,7 @@ pid_t have_baby() {
+ /*************************************************************
+  * Reap in all the dead children
+  **************************************************************/
+-void handle_sigchld() {
++void handle_sigchld(__attribute__((unused)) int sig) {
+       pid_t pid;
+       while ((pid = waitpid(-1, 0, WNOHANG)) > 0) {
+@@ -888,11 +888,15 @@ void handle_sigchld() {
+       return;
+ }
++void handle_exit(__attribute__((unused)) int sig) {
++      server_exit();
++}
++
+ /*************************************************************
+  * Do some final cleanup here.
+  **************************************************************/
+-void server_exit() {
++void server_exit(void) {
+       /*********************************************************
+        * If we're not the master process, don't do anything
+--- a/saslauthd/saslauthd-main.h
++++ b/saslauthd/saslauthd-main.h
+@@ -96,8 +96,9 @@ extern void  set_mech_option(const char *
+ extern void   set_run_path(const char *);
+ extern void   signal_setup();
+ extern void   detach_tty();
+-extern void   handle_sigchld();
+-extern void   server_exit();
++extern void   handle_sigchld(int sig);
++extern void   handle_exit(int sig);
++extern void   server_exit(void);
+ extern pid_t  have_baby();
+ /* ipc api delcarations */
+--- a/saslauthd/saslauthd_md5.h
++++ b/saslauthd/saslauthd_md5.h
+@@ -29,9 +29,8 @@ typedef struct {
+   unsigned char buffer[64];                         /* input buffer */
+ } MD5_CTX;
+-void _saslauthd_MD5Init PROTO_LIST ((MD5_CTX *));
+-void _saslauthd_MD5Update PROTO_LIST
+-  ((MD5_CTX *, unsigned char *, unsigned int));
+-void _saslauthd_MD5Final PROTO_LIST ((unsigned char [16], MD5_CTX *));
++void _saslauthd_MD5Init (MD5_CTX *);
++void _saslauthd_MD5Update (MD5_CTX *, unsigned char *, unsigned int);
++void _saslauthd_MD5Final (unsigned char [16], MD5_CTX *);
+-void _saslauthd_hmac_md5 PROTO_LIST ((unsigned char *, int, unsigned char *, int, caddr_t));
++void _saslauthd_hmac_md5 (unsigned char *, int, unsigned char *, int, caddr_t);